package com.trgis.yw.db;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public abstract class AccessUtils {

	protected Connection conn = null;

	protected Statement stat = null;

	protected String mdb;

	public ResultSet executeQuery(String sql) throws SQLException {
		if (conn == null) {
			getConn();
		}
		ResultSet resultSet = stat.executeQuery(sql);
		return resultSet;
	}

	public void executeUpdate(String sql) throws SQLException {
		if(conn == null) {
			getConn();
		}
		stat.executeUpdate(sql);
	}
	
	abstract void getConn() throws SQLException;

	public void destory() throws SQLException {
		if (stat != null)
			stat.close();
		if (conn != null)
			conn.close();
	}


}
